import java.util.*;
import java.io.*;

class Table  {
		private int nLines;
		private int nMaxLinesInRow;
		private List<Line> aTable;
		private String strDelim;

		private boolean ReadFromFile(String strFile) {

			boolean nNoErr = true;

			try {
					BufferedReader inputBuf = new BufferedReader(new FileReader(strFile));
					String aLine;
					while ((aLine = inputBuf.readLine()) != null) {
						AddALine(aLine);
					}
					inputBuf.close();
				}
				catch (IOException e) {
					System.out.println("File Read Error: " + e.toString());
					nNoErr = false;
			}

			return nNoErr;
		}

		Table(String strDLim) {
			nLines = 0;
			nMaxLinesInRow = 0;
			strDelim = strDLim;
			aTable = new ArrayList<Line>();
		}

		Table(String strFileName, String strDLim) {
			nLines = 0;
			nMaxLinesInRow = 0;
			aTable = new ArrayList<Line>();
			strDelim = strDLim;
			ReadFromFile(strFileName);
		}

		public boolean AddALine(String aLine) {
			Line newLine = new Line(aLine, strDelim);
			aTable.add(newLine);
			nLines++;
			nMaxLinesInRow = Math.max(nMaxLinesInRow, newLine.ItemsInLine());

			return true;
		}

		public boolean SetStringAt(int nAtLine, int nAtColumn, String str) {
			if (nAtLine > nLines-1 || nAtLine < 0)
				return false;
			Line objLine = aTable.get(nAtLine);

			return objLine.SetAt(nAtColumn, str);
		}

		public String GetALine(int nLineAt) {
			if (nLineAt > nLines-1 || nLineAt < 0)
				return null;
			Line objLine = aTable.get(nLineAt);

			return objLine.toString();

		}

		public String ReadAt(int nAtLine, int nAtColumn) {
			if (nAtLine > nLines-1 || nAtLine < 0)
				return null;
			Line objLine = aTable.get(nAtLine);

			return objLine.Get(nAtColumn);
		}

		public void PrintTable() {

			for (int n = 0; n < nLines ; n++) {
				System.out.println(GetALine(n));
			}
		}


		public boolean WriteToFile(String strFile) {

			boolean nNoErr = true;

			try {
					BufferedWriter outputBuf = new BufferedWriter(new FileWriter(strFile));

					for (int n = 0; n < nLines ; n++) {
						String aLine = GetALine(n);
						if (aLine != null) {
							outputBuf.write(aLine, 0, aLine.length());
							outputBuf.newLine();
						}
					}
					outputBuf.close();
				}
				catch(IOException e) {
						System.out.println("File Write Error: " + e.toString());
						nNoErr = false;
				}
				return nNoErr;
		}
	}



class StringTester {
	public static void main(String[] args) {
		String useDelim = 	new String(",\\s*");

		Table aTable = new Table("PersonsLog.txt", useDelim);
		aTable.PrintTable();
	}
}
